package com.beesphere.products.throttling.impl;

import java.util.concurrent.ExecutorService;

import com.beesphere.products.throttling.Throttler;
import com.beesphere.products.throttling.UnitOfWorkCapacity;
import com.beesphere.products.throttling.executor.ExecutorServiceFactory;
import com.beesphere.products.throttling.processor.async.ThreadProcessor;

public class PoolBasedThrottler extends Throttler {

	public PoolBasedThrottler (final ExecutorServiceFactory factory, final UnitOfWorkCapacity capacity) {
		super (new ThreadProcessor () {
			@Override
			protected ExecutorService createExecutor () {
				return factory.create (capacity);
			}
		}, capacity);
	}

}
